package com.web.service.impl;

import com.dto.BaseDto;
import com.dto.MessageEnum;
import com.entity.Selleractivityrecord;
import com.page.PageInfo;
import com.web.dao.SelleractivityrecordDao;
import com.web.service.SelleractivityrecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SelleractivityrecordServiceImpl implements SelleractivityrecordService {
    @Resource
    SelleractivityrecordDao selleractivityrecordDao;

    public BaseDto<Selleractivityrecord> getAll() throws Exception {
        List<Selleractivityrecord> selleractivityrecords = selleractivityrecordDao.getAll();
        MessageEnum messageEnum = selleractivityrecords.size() > 0? MessageEnum.GETALLSTUDENTSUCCESS: MessageEnum.GETALLSTUDENTNODATA;
        BaseDto<Selleractivityrecord> dto = new BaseDto(messageEnum,selleractivityrecords);

        return dto;
    }

    public BaseDto<Selleractivityrecord> getSelleractivityrecordsByPage(PageInfo pageInfo) throws Exception {
        List<Selleractivityrecord> selleractivityrecords = selleractivityrecordDao.getSelleractivityrecordsByPage(pageInfo);
        MessageEnum messageEnum = selleractivityrecords.size() > 0? MessageEnum.GETSTUDENTBYPAGESUCCESS: MessageEnum.GETSTUDENTBYPAGEFAIL;
        BaseDto<Selleractivityrecord> dto = new BaseDto(messageEnum,selleractivityrecords);

        return dto;
    }
}
